package com.kang.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @program: new_sql
 * @description: 统一返回格式
 * @author: K.faWu
 * @create: 2021-06-16 16:04
 **/
@Data
@AllArgsConstructor
public class Result<T> {
    private Integer code;
    private String mas;
    private T data;

    public static Result success(){
        return  Result.success("");
    }
    public static <T> Result<T> success(T data){
        return new Result(200,"success",data);
    }
    public static Result failure(){
        return Result.failure("");
    }
    public static Result failure(String msg){
        return Result.failure(500, msg);
    }
    public static Result failure(Integer code, String msg){
        return new Result(code,msg,"");
    }
}
